<template>
  <div>
    <!-- 卡片 -->
    <el-card class="box-card" style="margin-top: 10px">
      <!-- 按钮 -->
      <el-button type="primary" class="add">添加分类</el-button>
      <!-- 表格 -->
      <el-table :data="tableData" border style="width: 100%; margin-top: 10px">
        <el-table-column type="expand">
          <template slot-scope="props">
         
          </template>
        </el-table-column>
        <el-table-column label="索引" type="index" width="50px"> </el-table-column>
        <el-table-column label="分类名称" prop="cat_name"> </el-table-column>
        <el-table-column label="是否有效" prop="name"> </el-table-column>
        <el-table-column label="排序" prop="desc"> </el-table-column>

        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini" type="primary" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="danger"
               icon="el-icon-delete"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <!-- 卡片 -->
  </div>
</template>

<script>
import { goodF } from "@/request/api.js";
export default {
  data() {
    return {
      //表格数据
      tableData:[],
      //请求数据要求
      params:{
        type:[1,2,3],
        pagesize:10,
        pagenum:1
      },


    };
  },
  methods: {
    //页面数据
    getGoods(){
      goodF(this.params).then((res) => {
        // console.log(res)
        this.tableData = res.data.result
      })
    },
    //编辑
    handleEdit(index, row) {
      // console.log(index, row);
    },
    //删除
    handleDelete(index, row) {
      // console.log(index, row);
    },
  },
  created() {
    this.getGoods()
  },
  mounted() {},
  components: {},
  computed: {},
  watch: {},
};
</script>

<style lang='scss' scoped>
.add {
  margin-right: 1200px;
}
</style>
